using System;
using System.Collections.Generic;
using System.ComponentModel;

namespace HumanElement.Xna.Construct.GameState.MenuItems
{
    [DefaultProperty("Label")]
    public class NavigationReturnMenuItem : MenuItem
    {
        private string text;

        private const string LabelDefault = "Return to Previous";

        public NavigationReturnMenuItem()
        {
            this.text = LabelDefault;
        }

        [Category("Appearance")]
        [DefaultValue(LabelDefault)]
        public string Label
        {
            get { return text; }
            set
            {
                this.text = value;
            }
        }

        public override string GetText()
        {
            return this.text;
        }

        protected internal override void OnSelected()
        {
            // Raise the selected event first
            base.OnSelected();

            // Return to the previous screen.
            this.Parent.ExitScreen();
        }
    }
}
